import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import Pinia from "./store";
import * as echarts from "echarts";

import "element-plus/dist/index.css"; //element-plus
import * as ElIconModules from "@element-plus/icons-vue";
//svg
import "virtual:svg-icons-register";

//时间中文化
import dayjs from "dayjs";
import "dayjs/locale/zh-cn";
dayjs.locale("zh-cn");

import { getDict } from "@/common/utils/dict.js";
import permission from "@/common/utils/directives.js";
import setMaxLength from "@/common/utils/inputMaxLength.js";

const app = createApp(App);
//引入echarts
app.config.globalProperties.$echarts = echarts;
//注册icon
Object.keys(ElIconModules).forEach(function (key) {
  app.component(ElIconModules[key].name, ElIconModules[key]);
});

app.config.globalProperties.$dict = getDict; // 2，引入字典封装
app.use(permission); //自定义指令:判断按钮权限
app.use(setMaxLength); //自定义指令:输入框最大长度

// app.use(store);
app.use(Pinia);
app.use(router);
app.mount("#app");
